#!/usr/bin/env bash -e
echo "当前系统信息: $(uname -a)"

# 创建目录 /vscode/vscode-server/bin，如果目录已存在则不会报错
mkdir -p /vscode/vscode-server/bin

# 解压 .devcontainer 目录下的 vscode-server-linux-x64.tar.gz 文件
# -xzf 选项分别表示：x 解压文件，z 使用 gzip 压缩格式，f 指定要操作的文件
# -C /vscode/vscode-server/bin 表示将解压后的文件放置到 /vscode/vscode-server/bin 目录下
# --strip-components=1 表示去除解压文件路径中的第一层目录
tar -xzf .devcontainer/vscode-server-linux-x64.tar.gz -C /vscode/vscode-server/bin --strip-components=1

# ubuntu
# sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
# ... 已有代码 ...


# ubuntu
# sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
# sed -i 's/*.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list.d/ubuntu.sources
# cat /etc/apt/sources.list
echo 'Types: deb
URIs: https://mirrors.cernet.edu.cn/ubuntu
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

# 默认注释了源码镜像以提高 apt update 速度，如有需要可自行取消注释
# Types: deb-src
# URIs: https://mirrors.cernet.edu.cn/ubuntu
# Suites: noble noble-updates noble-backports
# Components: main restricted universe multiverse
# Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

# 以下安全更新软件源包含了官方源与镜像站配置，如有需要可自行修改注释切换
Types: deb
URIs: https://mirrors.cernet.edu.cn/ubuntu
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

# Types: deb-src
# URIs: https://mirrors.cernet.edu.cn/ubuntu
# Suites: noble-security
# Components: main restricted universe multiverse
# Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

# Types: deb
# URIs: http://security.ubuntu.com/ubuntu/
# Suites: noble-security
# Components: main restricted universe multiverse
# Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

# # Types: deb-src
# # URIs: http://security.ubuntu.com/ubuntu/
# # Suites: noble-security
# # Components: main restricted universe multiverse
# # Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

# 预发布软件源，不建议启用
# Types: deb
# URIs: https://mirrors.cernet.edu.cn/ubuntu
# Suites: noble-proposed
# Components: main restricted universe multiverse
# Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

# # Types: deb-src
# # URIs: https://mirrors.cernet.edu.cn/ubuntu
# # Suites: noble-proposed
# # Components: main restricted universe multiverse
# # Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
' | tee /etc/apt/sources.list.d/ubuntu.sources
# apt update

# sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# apk update
# apk add --no-cache git
# git config --global user.name "mifenghe"
# git config --global user.email "mifenghe@163.com"
# git config --global http.sslVerify "false"